<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/order.js"></script>
<script>

$.validator.setDefaults({
  submitHandler: function(form) { form.submit(); }
});
function JqValidate()  
{  
    return $( '#editForm' ).validate();  
}  
function submitBtn()  
{  
     if( JqValidate()){ 
	 //	alert(1);
         $( '#editForm' ).submit();  
    }  
}  
function showmonetytype()
{
	var mon=$("#moneytypes").val();
	$("#showmonetytype").html("<font color=red>("+mon+")</font>");	
	$("#showmonetytype2").html("<font color=red>("+mon+")</font>");	
}
</script>
<title>创建订单</title>

<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/leftmenu.tpl'}}
<div class="centercontent">
<div class="pageheader notab">
  <h1 class="pagetitle"> 创建新订单</h1>
  <div class="menulist">
    <ul class="profile_summary">
    </ul>
  </div>
</div>
<!--pageheader-->

<div id="contentwrapper" class="contentwrapper">
  <div id="basicform" class="subcontent">
    <form class="stdform stdform2"  id="editForm" method="post" action="/orderlist/saveorder">
      <input type="hidden" name="orderId" value="0">
      <input type="hidden" name="replay" value="{{$replay}}">
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <th colspan="2" class="head1">基础信息</th>
          </tr>
        </thead>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <tbody>
          <tr>
            <td class="head1" bgcolor="#FFFFFF">买家帐号 <font color="red"><B>*<span class="head0">
              <input type="text" id="customerid" name="customerid" value="{{$detail.customerid}}" required class="width100" />
              </span></B></font></td>
            <td class="head0" bgcolor="#FFFFFF">收款ID
              <input type="text" id="payid" name="payid" value="{{$detail.payid}}" class="width100" />
            <span class="head1"> </span></td>
            <td class="head0" bgcolor="#FFFFFF">收款帐户<span class="head1">
              <input type="text" id="payaccount" name="payaccount" class="width100"  value="{{$detail.payaccount}}"/>
              </span></td>
            <td class="head0" bgcolor="#FFFFFF"><span class="head1">客户来源 <font color="red">*
              <select name="shopID" id="shopname"  class="selection select2_group"  required >
                <option value="" >店铺</option>
                
        {{foreach from=$d_shop item=li key=key}}
                <option value="{{$li.id}}" {{if $detail.shopid==$li.id}}selected{{/if}}>{{$li.name}}</option>
                
        {{/foreach}}
          
              </select>
              </font></span></td>
            <td class="head0" bgcolor="#FFFFFF">订单属性 <font color="red">*<span class="head1">
              <select name="st" id="st" required>
                <option value="">-订单属性-</option>
                <option value="手工创建" {{if $st=='手工创建'}} selected{{/if}}>手工创建</option>
                <option value="补发订单" {{if $st=='补发订单'}} selected{{/if}}>补发订单</option>
                <option value="拆分订单" {{if $st=='拆分订单'}} selected{{/if}}>拆分订单</option>
                <option value="未收到重发" {{if $st=='未收到重发'}} selected{{/if}}>未收到重发</option>
                <option value="已收到重发" {{if $st=='已收到重发'}} selected{{/if}}>已收到重发</option>
                <option value="部分退款" {{if $st=='部分退款'}} selected{{/if}}>部分退款</option>
                <option value="全额退款" {{if $st=='全额退款'}} selected{{/if}}>全额退款</option>
                <option value="赞助订单" {{if $st=='赞助订单'}} selected{{/if}}>赞助订单</option>
              </select>
              </span></font></td>
            <td class="head0" bgcolor="#FFFFFF" >交易号 <font color="red">*<span class="head1"> </span></font>
              <input type="text" id="tradeid" class="width100" name="tradeid" value="{{$detail.tradeid}}" required />
            </td>
              
              
              <td class="head0" bgcolor="#FFFFFF">应收货款 <font color="red"><B>*</B></font><span id="showmonetytype"></span>:<span class="head0">
              <input name="goods_originask" required  value="0"  class="width50" type="text">
              {{if $replay==1}}未再次收取客人货款填写0{{/if}}
            </span></td>
            <td class="head0" bgcolor="#FFFFFF"><span class="head0">运费收入 <font color="red"><B>*</B></font>
                <input name="shipping_originask" required value="" class="width50" type="text">
            </span></td>
          </tr>
        
        </tbody>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <th colspan="2" class="head1">订单信息</th>
          </tr>
        </thead>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <tbody>
          <tr>
            <td class="head1" bgcolor="#FFFFFF">客户姓名 <font color="red"><B>*</B></font><input type="text" id="consignee" required name="consignee" class="width100" value="{{$detail.consignee}}"/></td>
            <td class="head0" bgcolor="#FFFFFF">所属地区 <font color="red"><B>*
                  <input type="text" id="province" class="width100" required name="province" value="{{$detail.province}}"/>
            </B></font></td>
            <td class="head0" bgcolor="#FFFFFF" width="15%"><span class="head1"> 国家 <font color="red"><B>*</B></font></span>
              <select name="country"  id="country"  class="selection select2_group" style="width:200px;" required >
                <option value="" >国家</option>
        {{foreach from=$d_country item=li key=key}}
                <option value="{{$li.countrynamecn}}" {{if $detail.country==$li.countrynamecn}}selected{{/if}}>{{$li.countrynamecn}}</option>
        {{/foreach}}
              </select>
            </td>
            <td class="head1" bgcolor="#FFFFFF"><span class="head0"> 邮政编码 <font color="red"><B>*
                    <input type="text" id="zipcode" required name="zipcode" class="width100" value="{{$detail.zipcode}}"/>
            </B></font></span></td>
            <td class="head1" bgcolor="#FFFFFF"><span class="head0"> 联系邮箱 <font color="red"><B>
                    <input type="text" id="email"  name="email" class="width100"  value="{{$detail.email}}"/>
            </B></font></span></td>
          
          </tr>
          <tr>
            <td class="head1" bgcolor="#FFFFFF">所属城市 <font color="red"><B>*<span class="head0">
              <input type="text" id="city" name="city" class="width100"  value="{{$detail.city}}" required />
            </span></B></font></td>
            <td class="head0" bgcolor="#FFFFFF"><span class="head1"> 联系电话 </span>
              <input type="text" id="tel"  name="tel" class="width100"  value="{{$detail.tel}}" />
            <td class="head0" bgcolor="#FFFFFF">货币类型：
            
            <select name="moneytype" id="moneytypes"  onBlur="showmonetytype()" required >
            <option value="">请选择</option>
          {{foreach item=li from=$moneyratelist key=key}}
          <option value="{{$li.name}}" {{if $detail.moneytype==$li.name}} selected{{/if}}>{{$li.name}}</option>
          {{/foreach}}
          </select>
            
            
           </td>
            <td colspan="2" bgcolor="#FFFFFF" class="head1">客户地址:<span class="head0"> <font color="red"><B> <font color="red"><B>*
            <input type="text" class="width200" id="address" required name="address"  value="{{$detail.address}}"/>
            </B></font></B></font></span></td>
          </tr>
         
        </tbody>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <th colspan="2" class="head1">其他信息</th>
          </tr>
        </thead>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <tbody>
          <tr>
            <td class="head0" bgcolor="#FFFFFF"><span class="head1">平台留言
                  <textarea name="platform_message" rows="2" cols="10" class="full_input">{{$detail.platform_message}}</textarea>
            </span></td>
           
         
            <td class="head0" bgcolor="#FFFFFF"><span class="head1">备注信息
              <textarea name="remark" rows="2" cols="10" class="full_input">{{$detail.remark}}</textarea>
            </span></td>
          
          </tr>
         
        </tbody>
      </table>
      <br>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <td bgcolor="#FFFFFF"><button type="button" onClick="addgoods({{$detail.order_id}})" class="btn btn-primary" > 增加商品 </button></td>
          </tr>
        </thead>
      </table>
      <br>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <th colspan="2" class="head1">订单商品</th>
          </tr>
        </thead>
      </table>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <th class="head1">编号</th>
            <th class="head0">商品编号</th>
            <th class="head1" width="30%">商品名称</th>
            <th class="head0" width="20%">数量</th>
            <th class="head0 right">销售价</th>
          </tr>
        </thead>
        <tbody id="addnewordergoodshtml">
        </tbody>
        {{foreach from=$goodslist item=li key=key}}
        <tr>
						<td height=58>
                        <input type="hidden" name="goods_id[]" value="{{$li.goods_id}}">
                        <input type="hidden" name="goods_sku[]" value="{{$li.goods_sn}}">
                         <input type="hidden" name="nums[]" value="{{$li.goods_number}}">
                         <input type="hidden" name="price[]" value="{{$li.originsellprice}}">
                    <font color="#6666FF">{{$li.goods_id}}</font></td><td height=58>
                    <font color="#6666FF">{{$li.goods_sn}}</font></td>
                    <td>{{$li.goods_name}}</td><td>{{$li.goods_number}}</td><td>{{$li.originsellprice}}</td>
							</tr>
         {{/foreach}}
       <!-- {{foreach from=$goodslist item=li key=key}}
        <tr>
          <td valign="middle" style="position:relative;"><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.rec_id}}"></td>
          <td valign="middle" style="position:relative;">{{if $li.local_url}} <a href="/{{$li.local_url}}" target="_blank"><img src="{{$li.thumb_url}}" height="60"></a>{{else}}<img src="{{$li.thumb_url}}" height="60">{{/if}}</td>
          <td>{{$li.goods_name}}<br>
            <a href="/product/showproduct?sku={{$li.goods_sn}}"><font color="#6666FF">{{$li.goods_sn}}</font></a> <br>
            {{if $detail.order_status==1 || $detail.order_status==2}} <span style="cursor:pointer" onClick="listTable.edit(this, 'changgoodsno','{{$li.rec_id}}','{{$li.goods_sn}}')">更换商品</span> {{/if}}
            
            {{if $li.goods_id==0}}
            <button type="button" onClick="addnewgoods('{{$li.goods_sn}}')" class="btn btn-primary" > 添加新的商品 </button>
            {{/if}} </td>
          <td><span style="cursor:pointer" onClick="listTable.edit(this, 'changmessage','{{$li.rec_id}}','{{$li.sale_remark}}')">{{if $li.sale_remark}}{{$li.sale_remark}}{{else}}编辑留言{{/if}}</span></td>
          <td >{{$li.goods_number}}</td>
          <td >{{$li.goods_price}}</td>
          <td >{{$li.goods_amount}}</td>
          <td >{{$li.costprice}}</td>
          <td >{{$li.maolilv}}%</td>
          <td >({{$detail.moneytype}}){{$li.originsellprice}}</td>
          <td >{{if $li.stock}}
            {{foreach from=$li.stock item=stock key=key}}
            {{$stock.storage_name}} &nbsp;&nbsp;&nbsp;库存[{{$stock.stock}}]
            {{if $stock.positions}}
            仓位[{{$stock.positions}}]
            {{/if}}
            {{/foreach}}
            {{else}}
            NULL
            {{/if}} </td>
        </tr>
        {{/foreach}}-->
      </table>
      <br>
      <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
        <thead>
          <tr>
            <td bgcolor="#FFFFFF"><button type="submit" class="btn btn-primary" > 保存订单信息 </button></td>
          </tr>
        </thead>
      </table>
      <br>
    </form>
  </div>
</div>

<!-- 模态框（Modal）添加商品 -->
<form action="/order/ajaxbutton?op=addorderNewgoods"   method="post" name="otherform" id="otherform" >
  <div class="modal fade" id="addattributeform" tabindex="-1" role="dialog" aria-labelledby="returnaddattributeform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnaddattributeform"> 增加商品 </h4>
         <br>注意请先设定货币：<select name="moneyratelist" id="moneyratelist">
          {{foreach item=li from=$moneyratelist key=key}}
          <option value="{{$li.name}}" {{if $detail.moneytype==$li.name}} selected{{/if}}>{{$li.name}}</option>
          {{/foreach}}
          </select></div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> 商品编号
                <input type="text" name="ordergoodsno[1]" id="ordergoodsno" class="width100" onBlur="getstatusgoods(this)" />
                订购数量
                <input type="text" name="ordergoodsnoNum[1]" id="ordergoodsnoNum" class="width100" />
                销售金额
                <input type="text" name="ordergoodsnoPrice[1]" id="ordergoodsnoPrice" class="width100" />
                <a href="javascript:void(0)"  onClick="showaddgoodsSKU('fileinput')" class="btn btn_book"><span>多增加一商品</span></a></td>
            </tr>
            <tbody id="fileinput">
            </tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSgoodssubmit('otherform','addattributeform',1)"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal）添加商品 -->

</body>
</html>